<?php

namespace App\Http\Middleware;

use Closure;
use Session;
class LoginMiddleware
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {	
		//登录权限验证
		//检测session中是否有登录信息
      
		 $response = $next($request);
		if($request->session()->has('uauth')&&$request->session()->has('uid')&&$request->session()->has('uname')){
			
			return $next($request);
		}else{
			//返回登录页面
			return redirect('/vadmin/login');
		}

        return $response;

    }
}
